﻿using System;
using System.Diagnostics;
using System.Threading;
using System.Windows;
using System.Windows.Controls;

namespace SLClient.CustomerControls
{
    public partial class SearchUserWindow : ChildWindow
    {
        private EventHandler _SearchHander;

        public event EventHandler SearchHander
        {
            add
            {
                EventHandler handler2;
                EventHandler searchHander = this._SearchHander;
                do
                {
                    handler2 = searchHander;
                    EventHandler handler3 = (EventHandler)Delegate.Combine(handler2, value);
                    searchHander = Interlocked.CompareExchange<EventHandler>(ref this._SearchHander, handler3, handler2);
                }
                while (searchHander != handler2);
            }
            remove
            {
                EventHandler handler2;
                EventHandler searchHander = this._SearchHander;
                do
                {
                    handler2 = searchHander;
                    EventHandler handler3 = (EventHandler)Delegate.Remove(handler2, value);
                    searchHander = Interlocked.CompareExchange<EventHandler>(ref this._SearchHander, handler3, handler2);
                }
                while (searchHander != handler2);
            }
        }

        public SearchUserWindow()
        {
            this.InitializeComponent();
        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.tbUserName.Text!= "")
            {
                this._SearchHander(this.tbUserName.Text, null);
                base.DialogResult = true;
            }
        }
    }
}

